#include <iostream>
#include <string>

int main() {
  std:: string c1;
  std:: string c;
  std:: cout << "Введите скобочную последовательность";
  std:: cin >> c;
  
  for(i c : c) {
    if (c=='(') {
      c1 += c;
    }

      
    if (c==')'){
      if (c1.lendth() > 0) {
        if ( c1[c1.length()-1] == '(' ) {
          c1.pop_back();
          }
        }
      }
    }
    if (c=='{') {
      c1 += c;
    }


    if (c=='}'){
      if (c1.lendth() > 0) {
        if ( c1[c1.length()-1] == '{' ) {
          c1.pop_back();
          }
        }
      }
    }
  if (c=='[') {
    c1 += c;
  }
  
  
  if (c==']'){
    if (c1.lendth() > 0) {
      if ( c1[c1.length()-1] == '[' ) {
        c1.pop_back();
        }
      }
    }
  }
  if (c=='<') {
    c1 += c;
  }


  if (c=='>'){
    if (c1.lendth() > 0) {
      if ( c1[c1.length()-1] == '<' ) {
        c1.pop_back();
        }
      }
    }
  }
  
  if (c1.length() == 0)
  {std:: cout << "True" << std:: endl;}
  else
  {std:: cout << "False"<<std::endl;}
}